from DrissionPage import Chromium
from DrissionPage._configs.chromium_options import ChromiumOptions
from DrissionPage.common import Settings

browser = Chromium(addr_or_opts=ChromiumOptions().auto_port())
browser.new_tab()
browser.new_tab()

# 未启用多例：
tab1 = browser.get_tab(1)
tab2 = browser.get_tab(1)
print(id(tab1), id(tab2))
# 启用多例：
# Settings.set_singleton_tab_obj(False)
# tab1 = browser.get_tab(1)
# tab2 = browser.get_tab(1)
# print(id(tab1), id(tab2))
# from DrissionPage._pages.session_page import SessionPage
# from fake_useragent import UserAgent
#
# page = SessionPage()
# page.set.user_agent(UserAgent().random)
#
# print(page.user_agent)